import { getRequest, postRequest } from '/src/lib/axios';

export const applicationManagementApi = {
  // 列表
  getFetch: (param) => {
    return getRequest('/apps/fetch',param);
  },
  // 分类下拉
  queryFindList: () => {
    return getRequest('/apps/category/findList');
  },

  // 新增OAuth2.x
  addOAuth20: (param) => {
    return postRequest('/apps/oauth20/add', param);
  },

  addjwt: (param) => {
    return postRequest('/apps/jwt/add', param);
  },
  // 修改OAuth2.x
  updateOAuth20: (param) => {
    return postRequest('/apps/oauth20/update', param);
  },

  updatejwt: (param) => {
    return postRequest('/apps/jwt/update', param);
  },
  // 获取OAuth2.x初始化数据
  initOAuth20:(param)=>{
    return getRequest('/apps/oauth20/init',param);
  },

  // SAML2.0
  addSaml20: (param) => {
    return postRequest('/apps/saml20/add', param);
  },
  updateSaml20: (param) => {
    return postRequest('/apps/saml20/update', param);
  },
  initSaml20:(param)=>{
    return getRequest('/apps/saml20/init',param);
  },
  
  // CAS认证
  addCas: (param) => {
    return postRequest('/apps/cas/add', param);
  },
  updateCas: (param) => {
    return postRequest('/apps/cas/update', param);
  },
  initCas:(param)=>{
    return getRequest('/apps/cas/init',param);
  },

  // JWT令牌
  addJwt: (param) => {
    return postRequest('/apps/jwt/add', param);
  },
  updateJwt: (param) => {
    return postRequest('/apps/jwt/update', param);
  },
  initjwt:(param)=>{
    return getRequest('/apps/jwt/init',param);
  },
  initUrlGet:(url,id)=>{
    return getRequest(`/apps${url}/get/${id}`);
  },

  // 令牌认证
  addTokenbased: (param) => {
    return postRequest('/apps/tokenbased/add', param);
  },
  updateTokenbased: (param) => {
    return postRequest('/apps/tokenbased/update', param);
  },
  initTokenbased:(param)=>{
    return getRequest('/apps/tokenbased/init',param);
  },

  // 表单认证
  addFormbased: (param) => {
    return postRequest('/apps/formbased/add', param);
  },
  updateFormbased: (param) => {
    return postRequest('/apps/formbased/update', param);
  },
  initFormbased:(param)=>{
    return getRequest('/apps/formbased/init',param);
  },

  // API扩展认证
  addExtendapi: (param) => {
    return postRequest('/apps/extendapi/add', param);
  },
  updateExtendapi: (param) => {
    return postRequest('/apps/extendapi/update', param);
  },
  initExtendapi:(param)=>{
    return getRequest('/apps/extendapi/init',param);
  },

  // 基本登录
  add: (param) => {
    return postRequest('/apps/add', param);
  },
  update: (param) => {
    return postRequest('/apps/update', param);
  },
  init:(param)=>{
    return getRequest('/apps/init',param);
  },
  getBasic:(id)=>{
    return getRequest(`/apps/get/${id}`);
  },
  

  // 删除
  delete: (param) => {
    return getRequest(`/apps/delete`,param);
  },

  // 基本信息分类
  findList: (param) => {
    return getRequest(`/apps/category/findList`,param);
  },
  // 获取应用密钥
  base: (param) => {
    return getRequest(`/apps/generate/secret/base`,param);
  },
  // 算法
  secret:(param,url)=>{
    return getRequest(`/apps/generate/secret/${url}`,param);
  }
};
